<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增记录')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-record-add">
            <div id="element1" class="row form-group">
                <label class="col-sm-3 control-label">途径地区：</label>
                <div class="col-sm-2">
                    <select class="province form-control m-b" name="province" data-first-title="选择省">
                    </select>
                </div>
                <div class="col-sm-2">
                    <select class="city form-control m-b" name="city" data-first-title="选择市">
                    </select>
                </div>
                <div class="col-sm-2">
                    <select class="area form-control m-b" name="area" data-first-title="选择地区">
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">途径时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="time" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">内容描述：</label>
                <div class="col-sm-8">
                    <textarea type="hidden" maxlength="200" class="form-control" name="content"></textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: jquery-cxselect-js" />
    <script th:inline="javascript">
        var prefix = ctx + "admin/record"
        $("#form-record-add").validate({
            focusCleanup: true
        });

        // 通过默认url获取
        var urlChina = 'treeList';
        $.cxSelect.defaults.url = urlChina;
        $('#element1').cxSelect({
            jsonValue: 'areaId',
            selects: ['province', 'city', 'area'],
            nodata: 'none'
        });

        $("input[name='time']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-record-add').serialize());
            }
        }
    </script>
</body>
</html>
